// owner-app/pages/my-card/index.js
import { handlerGobackClick, onlyChangeRouter } from "../../../utils/util";
const app = getApp();
import Apipublic from "../../../models/api";
const apipublic = new Apipublic();

Page({
  /**
   * 页面的初始数据
   */
  data: {
    form: {
      baseImgUrl: "",
      typesOfCertificateDesc: "",
      identificationNumber: "",
      name: "",
      sexDesc: "",
      nationDesc: "",
      permanentAddress: "",
    },
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {},

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {},
  handlerGobackClick,
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var { baseImgUrl } = getApp().globalImgUrl.config;
    this.setData({
      baseImgUrl,
    });
    this.initPageData();
  },
  initPageData() {
    let user = wx.getStorageSync("user");
    let data = {
      idCard: user.idcard,
      memberId: user.memberId,
    };
    apipublic.userInfoDetail(data).then((res) => {
      if (res.code == 1000) {
        this.setData({
          form: res.result,
        });
      }
    });
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {},
});
